﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Epitech.Krisk.Xna.UI.Game.InGame.Gameplay
{
    public enum PlayerState
    {
        Alive,
        Dead
    }

    public class Player
    {
        public Player()
        {
            OwnTerritory = new Dictionary<Territory, Army>();
            Cards = new List<TerritoryCard>();
            ReinforcementArmy = new Army();
            TotalArmy = new Army();
            Win = false;
        }

        public void Update(GameTime gameTime, TimeSpan gameStart)
        {
            if (OwnTerritory.Count == 0)
            {
                State = PlayerState.Dead;
                TimeToDeath = gameTime.TotalGameTime - gameStart;
            }
            TotalArmy = new Army(0);
            foreach (var army in OwnTerritory)
            {
                TotalArmy += army.Value;
            }
        }

        public bool Win { get; set; }
        public Color Color { get; set; }
        public String Name { get; set; }
        public Dictionary<Territory, Army> OwnTerritory { get; set; }
        public List<TerritoryCard> Cards { get; set; }
        public Army ReinforcementArmy { get; set; }
        public Army TotalArmy { get; set; }
        public TimeSpan TimeToDeath { get; set; }
        public PlayerState State { get; set; }
        public QuestCard QuestCard { get; set; }
    }
}
